package ar.com.photo_admin.taglibs
import ar.com.photo_admin.domain.*;


class PhotographerTagLib {

	def purchaseOrderService
	def springSecurityService
	
	def hasPaymentOnlineEnabled = { attrs, body ->
		Photographer photographer = Photographer.get(attrs.photographerId)
		if (photographer.paymentOnlineEnabled) {
			out << body()
		}
	}
	
	def isPhotographerOrHasOrdered = { attrs, body ->		
		def user = springSecurityService.getCurrentUser();
		if (!user.hasPhotographerRole() || purchaseOrderService.hasOrdered(user)) {
			out << body()
		}
	}
	
}
